import { Component, OnInit } from '@angular/core';

declare var form: any;

@Component({
  templateUrl: './data.directory.html'
})
export class DataMetadataDirectoryComponent implements OnInit {

  public fs: any = null;
  public dicTypeDic: any = null;

  constructor() {
    this.fs = new form.FormTreeService('metadatadirectory', {
      orderObject: { order: 0 },
      keyField: 'id',
      pageSize: 1000
    });
    // 加载表单数据
    this.fs.loadData();

    this.dicTypeDic = new form.DictionaryService('f_directory_type');
  }

  // 保存实体
  save() {
    const row = this.fs.er;
    if (row.directoryType === '2' || row.directoryType === '3') {
      row.leaf = true;
    } else {
      row.leaf = false;
    }
    this.fs.save(row);
  }

  ngOnInit(): void {

  }

}
